package me.itsoo.artemis.framework.repository.executor;

import me.itsoo.artemis.framework.repository.config.SqlConfigurable;
import me.itsoo.artemis.framework.repository.mapper.MapperDefinition;

import java.util.List;

/**
 * SqlExecutor
 *
 * @author zxy
 * @version 0.0.1
 * @since 2023/5/13
 */
public interface SqlExecutor extends SqlConfigurable {

    /**
     * 执行查询 SQL
     *
     * @param md         MapperDefinition
     * @param boundSql   BoundSql
     * @param resultType Class
     * @param <T>        T
     * @return Collection
     */
    <T> List<T> executeSelect(MapperDefinition md, BoundSql boundSql, Class<T> resultType);

    /**
     * 执行更新操作 SQL
     *
     * @param md          MapperDefinition
     * @param boundSql    BoundSql
     * @param executeType ExecuteType
     * @return int
     */
    int executeUpdate(MapperDefinition md, BoundSql boundSql, ExecuteType executeType);

    /**
     * 执行更新操作 SQL
     *
     * @param md          MapperDefinition
     * @param boundSql    BoundSql
     * @param executeType ExecuteType
     * @param autoCommit  boolean
     * @return int
     */
    int executeUpdate(MapperDefinition md, BoundSql boundSql, ExecuteType executeType, boolean autoCommit);

}
